import request from '@/utils/request'
/**
 * 获取员工简单列表
 */
export function getEmployeesListSimple() {
  return request({
    url: '/sys/user/simple'
  })
}

/**
 * 获取员工完整列表
 * @param {Object} params page,size
 */
export function getEmployeesList(params) {
  return request({
    url: '/sys/user',
    params
  })
}

/**
 * 新增员工
 * @param {*} data 用户信息
 */
export const addEmployees = data => {
  return request({
    url: '/sys/user',
    method: 'POST',
    data
  })
}

/**
 * 批量导入员工
 * @param {*} data []
 */
export const importEmployees = data => {
  return request({
    url: '/sys/user/batch',
    method: 'POST',
    data
  })
}

/**
 * 保存员工个人信息
 * @param {*} data 表单数据
 */
export const saveEmployeesInfo = data => {
  return request({
    url: `/employees/${data.id}/personalInfo`,
    method: 'PUT',
    data
  })
}

/**
 * 查询员工调岗信息
 * @param {*} id 用户ID
 */
export const getEmployeesJobInfo = id => {
  return request({
    url: `/employees/${id}/transferPosition`
  })
}

/**
 * 保存员工岗位信息
 * @param {*} data {}
 */
export const saveEmployeesJob = data => {
  return request({
    url: `/employees/${data.userId}/jobs`,
    method: 'PUT',
    data
  })
}
